/// @tags:
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <cstring>

typedef long long ll;

template <typename T>
inline T &read(T &x) {
  x = 0;
  bool f = false;
  short ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = true;
    ch = getchar();
  }
  while (isdigit(ch)) x = (x << 1) + (x << 3) + (ch ^ '0'), ch = getchar();
  if (f) x = -x;
  return x;
}

const int N = 5e5 + 5, lim = 1000;
int n, m, k;
ll f[N];

struct Node {
  int w;
  ll v;
  bool operator<(const Node &rhs) const { return v * rhs.w > rhs.v * w; }
} a[N];

int main() {
#ifndef ONLINE_JUDGE
#ifdef LOCAL
  freopen64("/tmp/CodeTmp/testdata.in", "r", stdin);
  freopen64("/tmp/CodeTmp/testdata.out", "w", stdout);
#else
  freopen("magic.in", "r", stdin);
  freopen("magic.out", "w", stdout);
#endif
#endif

  read(n), read(m), read(k);
  for (int i = 1; i <= n; i++) read(a[i].w), read(a[i].v);
  std::sort(a + 1, a + n + 1);
  int r = 0, l = 0;
  for (int i = 1; i <= n; i++) {
    r += a[i].w, l += a[i].w;
    r = std::min(r, m), l = std::min(l, r - lim), l = std::max(l, 0);
    for (int j = r; j >= l; j--)
      if (j >= a[i].w) f[j] = std::max(f[j], f[j - a[i].w] + a[i].v);
  }
  for (int i = 1; i <= m; ++i) printf("%lld\n", f[i]);
  return 0;
}